<?php
/**
 * @version		$Id: default.php 21518 2011-06-10 21:38:12Z chdemko $
 * @package		Joomla.Site
 * @subpackage	com_content
 * @copyright	Copyright (C) 2005 - 2011 Open Source Matters, Inc. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */

// no direct access
defined('_JEXEC') or die;
?>

<script type="text/javascript">
<!--
jQuery.noConflict();

jQuery().ready(function($){
	$("a[rel^='youtube']").click(function(){
		$(this).prettyPhoto({'social_tools': null});
		return false;
	});
});
//-->
</script>

<ul id="je-youtube-home">
	<?php foreach ($this->items as $item): ?>
	<li>
		<?php 
		//get id
		$pattern = '/[\?&]v=([^&#]*)/';
		preg_match($pattern, $item->links, $matches, PREG_OFFSET_CAPTURE, 3);
		$matchId = $matches[1][0];
		?>
		<a class="youtube" href="<?php echo $item->links; ?>" rel="youtube" title="<?php echo $item->name; ?>">
			<img src="http://img.youtube.com/vi/<?php echo $matchId?>/default.jpg" alt="<?php echo $item->name; ?>" />
		</a>
	</li>
	<?php endforeach; ?>
</ul>